<template>
	<view>
		<view>
			<view style="margin: 20rpx 0;"class="u-flex">
				<u-avatar :src="$url+author.avatar"></u-avatar>
				<view style="margin-left: 20rpx;">
					<view>{{author.authorName}}</view>
					<view style="color: #B2B2B4;">{{item.updateTime | formatDate}}</view>
				</view>
			</view>
			<view style="font-size: 32rpx;">
				<view>我更新了一章</view>
				<view>{{item.chapterName}}</view>
			</view>
			<view style="margin: 10rpx;background-color: #f7f7f7;border-radius: 0.5em;padding: 30rpx;
			justify-content: space-between;"
			class="u-flex" @click="itemClick(item.bookdataId)">
				<image :src="$url+item.imageUrl" mode="aspectFill"
				style="width: 80rpx;height: 120rpx;"></image>
				<view style="flex: 1;margin: 0 20rpx;">
					<view>{{item.name}}</view>
					<view style="color: #808080;">{{item.types}}&nbsp;·&nbsp;{{item.state}}&nbsp;·&nbsp;{{item.heat}}万热度</view>
				</view>
				<view style="color: #e76f3b;">{{item.score}}分</view>
			</view>
<!-- 			<view style="justify-content: space-evenly;margin-top: 30rpx;" class="u-flex">
				<view>
					<u-icon name="heart"></u-icon>点赞
				</view>
				<view>
					<u-icon name="star"></u-icon>关注
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		props:["item","author"],
		name:"authorComment",
		data() {
			return {
				
			};
		},
		methods:{
			itemClick(e){
				console.log(e)
				this.$emit("itemClick",e)
			}
		},
		filters: {
		  numFilter (value) {
		    // 截取当前数据到小数点后两位
		    let realVal = parseFloat(value).toFixed(2)
		    return realVal
		  },
		  formatDate(value) {
		  	if(value == undefined){
		  		return;
		  	}
		  	// let date = new Date(value * 1000);
		  	let date = new Date(value);
		  	//时间戳为10位需*1000，时间戳为13位的话不需乘1000
		  	let y = date.getFullYear();
		  	let MM = date.getMonth() + 1;
		  	MM = MM < 10 ? ('0' + MM) : MM; //月补0
		  	let d = date.getDate();
		  	d = d < 10 ? ('0' + d) : d; //天补0
		  	let h = date.getHours();
		  	h = h < 10 ? ('0' + h) : h; //小时补0
		  	let m = date.getMinutes();
		  	m = m < 10 ? ('0' + m) : m; //分钟补0
		  	let s = date.getSeconds();
		  	s = s < 10 ? ('0' + s) : s; //秒补0
		  	// return y + '-' + MM + '-' + d; //年月日
		  	return y + '-' + MM + '-' + d + ' ' + h + ':' + m+ ':' + s; //年月日时分秒
		  }
		}
	}
</script>

<style>

</style>
